//
//  KeChengNextCell.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/17.
//  Copyright © 2019 SanYi. All rights reserved.
//

#import "KeChengNextCell.h"

@implementation KeChengNextCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubView];
    }
    return self;
}

- (void)initSubView{
    CGFloat W = (705*fw)/8;
    for (int i = 0; i<8; i++) {
        if (i==7) {
            _button = [UIButton buttonWithType:UIButtonTypeSystem];
            _button.frame = CGRectMake(W*i, 0, W, 40);
            [_button setTitle:@"查看" forState:UIControlStateNormal];
            _button.titleLabel.font = [UIFont systemFontOfSize:12];
            [self.contentView addSubview:_button];
        }else{
            UILabel *label = [[UILabel alloc]init];
            label.frame = CGRectMake(W*i, 0, W, 40);
            label.text = @"haha";
            label.textAlignment = 1;
            label.textColor = [UIColorChange colorwithHexString:@"#333333"];
            label.font = [UIFont systemFontOfSize:12];
            label.tag = 20+i;
            [self.contentView addSubview:label];
        }
    }
    [self.button addTarget:self action:@selector(lookUp:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)lookUp:(UIButton *)sender{
    [[NSNotificationCenter defaultCenter]postNotificationName:@"XueShengXiangQingShowNotice" object:nil userInfo:@{@"status":@"1",@"index":[NSString stringWithFormat:@"%d",self.index]}];
}
- (void)reloadViewLayout{
    CGFloat W = self.frame.size.width/8;
    for (int i = 0; i<8; i++) {
        if (i == 7) {
            _button.frame = CGRectMake(W*i, 0, W, 40);
        }else{
            UILabel *label = (UILabel *)[self viewWithTag:i+20];
            label.frame = CGRectMake(W*i, 0, W, 40);
        }
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
